#include "policymanager.h"
#include "basedock.h"
#include "splitter.h"


bool QPolicyManager::isRepositionable(QWidget *widget)
{
    return true;
}

bool QPolicyManager::isDetachable(QWidget *widget)
{
    return true;
}

DockOption QPolicyManager::dockOptions(QWidget *dragged_widget, QDockItem *target)
{
    if (dragged_widget == target)
        return DockOption::NoDock;
    QBaseDock* base_dock = qobject_cast<QBaseDock*>(target);
    if (base_dock){
        if (!base_dock->noContent()){
            return (DockOption::CROSS);
        }
    }
    if (qobject_cast<QBaseDock*> (target->parentDockItem())){
        //we are directly underneath the basedock
        if (qobject_cast<USplitter*>(target)){
            //do not allow anything in the splitter in the basedock
            return DockOption::NoDock;
        }
    }
    return (DockOption)(DockOption::CROSS | DockOption::Tabbed);
}
